package com.situ.mall.product.controller;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.situ.mall.common.util.Result;
import com.situ.mall.pojo.entity.product.Carousel;
import com.situ.mall.product.service.ICarouselService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author Z
 * @since 2024-10-09
 */
@RestController
@RequestMapping("/product/carousel")
public class CarouselController {
    @Autowired
    ICarouselService carouselService;
    @RequestMapping("/listPortal")
    public Result listPortal() {
        QueryWrapper<Carousel> queryWrapper = new QueryWrapper<>();
        queryWrapper.orderByAsc("priority").last("limit 4");
        List<Carousel> list = carouselService.list(queryWrapper);
        return Result.ok(list);
    }
}

